#include <iostream>
#include <map>
using namespace std;
int n;
map<int,int>q;
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		int x;cin>>x;
		++q[x];
	}
	for(map<int,int>::iterator it=q.begin();it!=q.end();++it)
		cout<<it->first<<' '<<it->second<<endl;
	return 0;
}
